package com.kust.smarhome.background.controller;


import cn.hutool.core.map.MapUtil;
import com.kust.smarhome.background.common.dto.MenuDto;
import com.kust.smarhome.background.common.lang.Result;
import com.kust.smarhome.background.service.IMenuService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author iAuzre
 * @since 2021-07-31
 */
@RestController
@RequestMapping("/sys/menu")
public class MenuController {

    @Resource
    private IMenuService menuService;

    @PostMapping("/nav")
    public Result nav() {

        List<MenuDto> navs = menuService.nav();

        return Result.succ(
                MapUtil.builder()
                .put("nav",navs)
//                .put("auth","admin")
                .map()
        );
    }

}
